package org.jsola.contract.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.contract.dto.ContractAddDTO;
import org.jsola.contract.dto.ContractBatchDTO;
import org.jsola.contract.dto.ContractUpdateDTO;
import org.jsola.contract.dto.PdfToContractAddDTO;
import org.jsola.contract.query.ContractQuery;
import org.jsola.contract.vo.ContractListVO;
import org.jsola.contract.vo.ContractVO;
import org.jsola.core.Page;
import org.jsola.core.Result;

import java.util.List;

/**
 * 合同
 *
 * @author JanusMix
 */
@Api(tags = "contract-合同")
public interface IContractControllerAPI {

    /**
     * 新增合同
     *
     * @param contractAddDTO 合同新增实体
     * @return 合同展示对象
     */
    @ApiOperation(value = "新增合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractAddDTO", dataType = "ContractAddDTO", value = "新增合同", paramType = "body")
    })
    Result<ContractVO> save(ContractAddDTO contractAddDTO);


    /**
     * 修改合同
     *
     * @param contractUpdateDTO 合同
     * @return 更新数量
     */
    @ApiOperation(value = "修改合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractUpdateDTO", dataType = "ContractUpdateDTO", value = "修改合同", paramType = "body")
    })
    Result<Integer> update(ContractUpdateDTO contractUpdateDTO);

    /**
     * 批量编辑、新增、删除合同
     *
     * @param contractBatchDTO 要操作的合同
     * @return 操作之后的全部合同
     */
    @ApiOperation(value = "批量编辑、新增、删除合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractBatchDTO", dataType = "ContractBatchDTO", value = "要操作的字段数据", paramType = "body")
    })
    Result batch(ContractBatchDTO contractBatchDTO);


    /**
     * 删除单个合同，彻底删除
     *
     * @param contractId 合同id
     * @return 删除数量
     */
    @ApiOperation(value = "删除单个合同，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractId", dataType = "Long", value = "合同id", paramType = "path")
    })
    Result<Integer> delete(Long contractId);


    /**
     * 批量删除合同，彻底删除
     *
     * @param contractIds 合同id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除合同，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractIds", dataType = "Long[]", value = "合同id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(Long[] contractIds);


    /**
     * 根据合同id查询合同详情
     *
     * @param contractId 合同id
     * @return 合同详情
     */
    @ApiOperation(value = "根据合同id查询合同详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractId", dataType = "Long", value = "合同id", paramType = "path")
    })
    Result<ContractVO> findById(Long contractId);


    /**
     * 查询合同
     *
     * @param contractQuery 合同查询参数
     * @return page
     */
    @ApiOperation(value = "查询合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractQuery", dataType = "ContractQuery", value = "合同查询参数", paramType = "query")
    })
    Result<List<ContractListVO>> listAll(ContractQuery contractQuery);


    /**
     * 分页查询合同
     *
     * @param contractQuery 合同查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractQuery", dataType = "ContractQuery", value = "合同查询参数", paramType = "query")
    })
    Result<Page<ContractListVO>> page(ContractQuery contractQuery);


    /**
     * 根据合同id修改合同编号
     *
     * @param contractId        合同id
     * @param contractUpdateDTO 只使用合同编号
     * @return 合同详情
     */
    @ApiOperation(value = "根据合同id修改合同编号")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractId", dataType = "Long", value = "合同id", paramType = "path"),
            @ApiImplicitParam(name = "contractUpdateDTO", dataType = "ContractUpdateDTO", value = "只使用编号", paramType = "body")
    })
    Result<String> updateContractNoById(Long contractId, ContractUpdateDTO contractUpdateDTO);

    /**
     * 根据合同id修改小程序app是否展示
     *
     * @param contractId 合同id
     * @param isShow     小程序是否展示合同
     * @return 合同详情
     */
    @ApiOperation(value = "根据合同id修改小程序app是否展示")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "contractId", dataType = "Long", value = "合同id", paramType = "path"),
            @ApiImplicitParam(name = "isShow", dataType = "Boolean", value = "小程序是否展示合同(true:展示,false:不展示)", paramType = "path")
    })
    Result<String> updateAppShowById(Long contractId, Boolean isShow);

    /**
     * 根据pdf新增合同
     *
     * @param pdfToContractAddDTO 根据pdf新增合同实体
     * @return 合同展示对象
     */
    @ApiOperation(value = "根据pdf新增合同")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pdfToContractAddDTO", dataType = "PdfToContractAddDTO", value = "根据pdf新增合同实体", paramType = "body")
    })
    Result<Integer> saveWordToContract(PdfToContractAddDTO pdfToContractAddDTO);

}

